/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author whb108
 *
 * @version 0.1
 *
 */
public class TimeConverter {

    private static final int SECONDSPERMINUTE = 60;
    private static final int MINUTESPERHOUR = 60;
    
    private boolean bDebugging = true;
    private int intHours;
    private int intMinutes;
    private int intSeconds;

    
    TimeConverter()
    {
        setSeconds(0);
         setMinutes(0);
          setHours(0);
    }
    TimeConverter(int intInputHours,
            int intInputMinutes,
            int intInputSeconds) {

       
       
        setSeconds(intInputSeconds);
         setMinutes(intInputMinutes);
          setHours(intInputHours);
          
          

  } // no argument constructor  

    public void setHours(String strInput)
    {
        setHours(Integer.parseInt(strInput));
        System.out.println("Setting hours from string input");
    }
    
    public void setHours(int intInputHours) {
        intHours += intInputHours;
    } // setHours

    public int getHours() {
        return intHours;
    } // getHours

    public void setMinutes(int intInputMinutes) {
        // intMinutes += intInputMinutes;
        
        setHours(intInputMinutes / MINUTESPERHOUR);
         intMinutes += intInputMinutes % MINUTESPERHOUR;
        
    } // setMinutes

    public int getMinutes() {
        return intMinutes;
    } // getMinutes

    public void setSeconds(int intInputSeconds) {
        
         setMinutes(intInputSeconds / SECONDSPERMINUTE);
         intSeconds = intInputSeconds % SECONDSPERMINUTE;
       
    } // setSeconds

    public int getSeconds() {
        return intSeconds;
    } // getSeconds
    
    
    public String getFormattedTime()
    {
        StringBuffer strReturn = new StringBuffer();
         strReturn.append( "Time = " + getHours()
                   + ":" + getMinutes()
                   + ":" + getSeconds());
        return strReturn.toString();
      
    } // getFormattedTime

    public static void main(String args[]) {
        TimeConverter myTC = new TimeConverter(0, 0, 7200);
        if (myTC.bDebugging == true) {
            System.out.println("Hours = " + myTC.getHours());
            System.out.println("Minutes = " + myTC.getMinutes());
            System.out.println("Seconds = " + myTC.getSeconds());
            
            System.out.println("Formatted Time = " + myTC.getFormattedTime());
        }

    } // main
} // class TimeConverter
